package com.remist.dao.impl.jpa;

import javax.persistence.EntityManager;

import org.springframework.orm.jpa.support.JpaDaoSupport;

import com.remist.dao.NewsDao;
import com.remist.model.News;

public class NewsDaoImpl extends JpaDaoSupport implements NewsDao {

	public boolean addNews(News newsBean) {
		getJpaTemplate().persist(newsBean);
//		EntityManager em =getJpaTemplate().getEntityManagerFactory().createEntityManager();
//		em.persist(newsBean);
//		em.flush();
//		getJpaTemplate().flush();
		/*
		getJpaTemplate().setEntityManager(getJpaTemplate().getEntityManagerFactory().createEntityManager()); 
		getJpaTemplate().getEntityManager().getTransaction().begin(); 
		getJpaTemplate().persist(newsBean); 
		getJpaTemplate().getEntityManager().getTransaction().commit(); 
 */
		return true;
	}

}
